home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48hor1
/
prepl.src
< prev
next >
Wrap
Text File
|
1991-07-01
|
2KB
|
45 lines
%%HP: T(3)A(R)F(.);
@ by Ted A. Smith
@
@ This routine runs very slow, but seems to work even if there
@ are ML or Code fragments in the program object (which couldn't
@ be said for doing something like: \->STR replacie replacer
@ REPLACE OBJ\->. Is there a saner way?
@
@ If there were routines like GETI, PUTI, etc. which, besides
@ working on lists and arrays, worked on programs, algebraic's,
@ etc. things would be a little easier.
@
DIR
PRepl @ <program> <replacies list> <replacers list> => <new program>
\<< \-> \GaPRepl \GbPRepl
\<< DUP TYPE
CASE DUP 8 SAME THEN @ for program objects
DROP Cmp\-> \->LIST
\<< \GaPRepl \GbPRepl PRepl \>> Each
OBJ\-> \->LPgm
END DUP 5 SAME THEN @ for lists
DROP
\<< \GaPRepl \GbPRepl PRepl \>> Each
END @ else, for all others
DROP \GaPRepl OVER POS
IF DUP THEN
SWAP DROP \GbPRepl SWAP GET
ELSE
DROP END END \>> \>>
Each @ Apply the function in level 1 to each element of the
@ list or array in level 2
\<< OVER { }
IF SAME THEN
DROP
ELSE SWAP 1
DO
DUP2 GET 4 PICK EVAL PUTI -64
UNTIL FS? END
ROT DROP2 END \>>
Cmp\->.ASC @ \->ASC'ed routine which unpacks programs, algebraics, ...
"D9D20ECE8112040379C1F3040379C194040379C1B7040379C1B21303471"
\->LPgm.ASC @ \->ASC'ed routine which repacks a program object
"D9D2043C8154450B21305CEC"
END